package com.lovo.cloudtwo.controller;

import com.lovo.utile.model.MeiTuanDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Description:
 *
 * @author WL
 * @date Created on 2020/11/30
 */
@RestController
public class UserController {
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("buy")
    public  String  buyMovie(String movieName,Integer num){
        System.out.println(movieName);
        String result = "";
        MeiTuanDTO dto = new MeiTuanDTO();
        dto.setMovieName(movieName);
        dto.setNum(num);

        result=
        restTemplate.postForEntity("http://127.0.0.1:8080/sell",dto,String.class).getBody();

        return result;
    }
}
